#include "FileLayout.h"

#include <QLabel>
#include <QToolButton>
#include <QSize>
#include <QSplitter>
#include <QGroupBox>

FileLayout::FileLayout()
{

}


FileLayout::FileLayout(
    QHBoxLayout* widget)
{
    widget->addLayout(this);
    widget->addSpacing(100);
    this->add_sub_widget();

    QLabel* lab = new QLabel(tr("11"));
    lab->setMaximumWidth(1);
    lab->setMaximumHeight(200);
    lab->setFrameShape (QFrame::Box);
    lab->setStyleSheet("border-width: 1px;border-style: solid;border-color: rgb(0, 0, 0);");
    widget->addWidget(lab);
}



FileLayout::FileLayout (
    QGroupBox* box)
{
    //box->setLayout(this);
    //(100);
    this->add_sub_widget();
}



FileLayout::~FileLayout()
{

}



FileLayout::FileLayout (
    const int row,
    const int column)
{
    for (std::size_t i = 0; i < row; i++)
    {
        this->setRowStretch(i,1);
    }
}



void
FileLayout::set_grid(
    const int row,
    const int column)
{
    for (std::size_t i = 0; i < row; i++)
    {
        this->setRowStretch(i,1);
    }
}



void
FileLayout::add_sub_widget ()
{
    QToolButton* file_new = new QToolButton;

    //file_new->setIconSize(QSize(50,50));
    file_new->setIcon(QIcon(":/resource/image/new.png"));
    this->addWidget(file_new,0,0);
    file_new->setToolTip(tr ("新建"));

    QToolButton* file_save = new QToolButton;
    file_save->setIcon(QIcon(":/resource/image/save.png"));
    this->addWidget(file_save,1,0);
    file_save->setToolTip(tr ("保存"));

    QToolButton* file_import = new QToolButton;
    file_import->setIcon(QIcon(":/resource/image/import.png"));
    this->addWidget(file_import,2,0);
    file_import->setToolTip(tr ("导入"));

    QToolButton* file_saveAs = new QToolButton;
    file_saveAs->setIcon(QIcon(":/resource/image/saveAs.png"));
    this->addWidget(file_saveAs,3,0);
    file_saveAs->setToolTip(tr ("另存为"));

}
